const Router = require('@koa/router')
const { server } = require('../env')
const auth = require('../middleware/auth')
const { verifyCdk } = require('../middleware/cdk.middleware')
const cdkController = require('../controller/cdk.controller')

// 奖品相当于金额 => amount
const cdkRouter = new Router({ prefix: `${server.pathPrefix}/cdk` })

cdkRouter.post('/', auth, verifyCdk, cdkController.exchange) // 兑换奖品
cdkRouter.get('/one', auth, cdkController.getOne)// 生成兑换码
cdkRouter.get('/list', auth, cdkController.list)// 获取兑换码列表

module.exports = cdkRouter